home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / BMP.H < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  1.9 KB  |  81 lines

  1. #ifndef _BMP_H
  2. #define _BMP_H
  3.  
  4. #define xBI_NONE  0
  5. #define xBI_RGB   0
  6. #define xBI_RLE4  2
  7. #define xBI_RLE8  1
  8.  
  9. #define BMP_SIGNATURE_WORD  0x4d42
  10.  
  11. #pragma pack(1)
  12.  
  13.  
  14.  
  15. typedef struct {
  16.     unsigned short    bfType;       // signature - 'BM'
  17.     unsigned long     bfSize;       // file size in bytes
  18.     unsigned short    bfReserved1;  // 0
  19.     unsigned short    bfReserved2;  // 0
  20.     unsigned long     bfOffBits;    // offset to bitmap
  21. } bmphd_t;
  22.  
  23.  
  24.  
  25. typedef struct {
  26.     unsigned long     biSize;       // size of this struct
  27.     long              biWidth;      // bmap width in pixels
  28.     long              biHeight;     // bmap height in pixels
  29.     unsigned short    biPlanes;     // num planes - always 1
  30.     unsigned short    biBitCount;   // bits perpixel
  31.     unsigned long     biCompression; // compression flag
  32.     unsigned long     biSizeImage;   // image size in bytes
  33.     long              biXPelsPerMeter; // horz resolution
  34.     long              biYPelsPerMeter; // vert resolution
  35.     unsigned long     biClrUsed;       // 0 -> color table size
  36.     unsigned long     biClrImportant;  // important color count
  37. } binfo_t;
  38.  
  39.  
  40. typedef struct {
  41.     unsigned char blue;
  42.     unsigned char green;
  43.     unsigned char red;
  44.     unsigned char reserved;
  45. } drgb_t;
  46.  
  47.  
  48. // quake expects its palette to be bgr
  49. // this is totally backwards but what can you do
  50. typedef struct {
  51.     unsigned char r;
  52.     unsigned char g;
  53.     unsigned char b;
  54. } rgb_t;
  55.  
  56.  
  57. typedef struct {
  58.     unsigned char b;
  59.     unsigned char g;
  60.     unsigned char r;
  61. } bgr_t;
  62.  
  63.  
  64. typedef struct {
  65.     int            bpp;        // bits per pixel
  66.     int            width;
  67.     int            height;
  68.     unsigned char *data;
  69.     rgb_t         *palette;
  70. } bitmap_t;
  71.  
  72.  
  73. void  LoadBMP(char *filename, bitmap_t *bit);
  74. void FreeBMP(bitmap_t *bitmap);
  75. void WriteBMP(char *filename, bitmap_t *bit);
  76. void NewBMP(int width, int height, int bpp, bitmap_t *bit);
  77.  
  78.  
  79.  
  80. #endif
  81.